package strangeattractor.equations;

import strangeattractor.core.DPoint;
import strangeattractor.core.Transformer;

public class Lorenz implements Transformer {

	public double A, B, C, D;
	
	public Lorenz(double a, double b, double c, double d) {
		super();
		A = a;
		B = b;
		C = c;
		D = d;
	}

	@Override
	public DPoint next(DPoint previous) {
		double xNew = previous.x + A*D*(previous.y-previous.x);
		double yNew = previous.y + D*(B*previous.x - previous.y - previous.z*previous.x);
		double zNew = previous.z + D*(previous.x*previous.y - C*previous.z);
		return new DPoint(xNew, yNew, zNew);
	}

}
